class GameStats:
    """跟踪游戏的统计信息"""

    def __init__(self, ai_game):
        """初始化统计信息"""
        self.settings = ai_game.settings
        self.reset_stats()

        # 游戏刚启动时处于活动状态
        self.game_active = False

        # 最高得分只用初始化一次，只能被刷新不能被重置
        # 很神奇的是，文件的相对路径是根据运行的main.py来确定的
        with open(".\\score\\high_score.txt") as highscore_file:
            self.high_score = int(highscore_file.read())

    def reset_stats(self):
        """初始化（或者说重置）在游戏运行期间可能变化的统计信息"""
        self.ships_left = self.settings.ship_limit - 1
        self.score = 0
        self.level = 1
